package com.ytf.test.fourth;

import java.util.Random;

/**
 * @author: YTF
 * @date: 2024/9/14 17:57
 * @version: 1.0
 * @description: 使用switch 来判断元音还是辅音
 */
public class VowelsAndConsonants {
    public static void main(String[] args) {
        Random random = new Random(47);
        for (int i = 0; i < 100; i++) {
            int c = random.nextInt(26)+'a';
            System.out.println("c: "+c+" (char)c"+(char)c);
            switch (c){
                case 'a':
                case 'e':
                case 'i':
                case 'o':
                case 'u':
                    System.out.println(" vowel");
                    break;
                case 'y':
                case 'w':
                    System.out.println(" Sometimes a vowel");
                    break;
                default:
                    System.out.println(" consonant");
            }
        }
        /**
         * Output:
         * c: 121 (char)cy
         *  Sometimes a vowel
         * c: 110 (char)cn
         *  consonant
         * c: 122 (char)cz
         *  consonant
         * c: 98 (char)cb
         *  consonant
         * c: 114 (char)cr
         *  consonant
         * c: 110 (char)cn
         *  consonant
         * c: 121 (char)cy
         *  Sometimes a vowel
         * c: 103 (char)cg
         *  consonant
         * c: 99 (char)cc
         *  consonant
         * c: 102 (char)cf
         *  consonant
         * c: 111 (char)co
         *  vowel
         * c: 119 (char)cw
         *  Sometimes a vowel
         * c: 122 (char)cz
         *  consonant
         * c: 110 (char)cn
         *  consonant
         * c: 116 (char)ct
         *  consonant
         * c: 99 (char)cc
         *  consonant
         * c: 113 (char)cq
         *  consonant
         * c: 114 (char)cr
         *  consonant
         * c: 103 (char)cg
         *  consonant
         * c: 115 (char)cs
         *  consonant
         * c: 101 (char)ce
         *  vowel
         * c: 103 (char)cg
         *  consonant
         * c: 122 (char)cz
         *  consonant
         * c: 109 (char)cm
         *  consonant
         * c: 109 (char)cm
         *  consonant
         * c: 106 (char)cj
         *  consonant
         * c: 109 (char)cm
         *  consonant
         * c: 114 (char)cr
         *  consonant
         * c: 111 (char)co
         *  vowel
         * c: 101 (char)ce
         *  vowel
         * c: 115 (char)cs
         *  consonant
         * c: 117 (char)cu
         *  vowel
         * c: 101 (char)ce
         *  vowel
         * c: 99 (char)cc
         *  consonant
         * c: 117 (char)cu
         *  vowel
         * c: 111 (char)co
         *  vowel
         * c: 110 (char)cn
         *  consonant
         * c: 101 (char)ce
         *  vowel
         * c: 111 (char)co
         *  vowel
         * c: 101 (char)ce
         *  vowel
         * c: 100 (char)cd
         *  consonant
         * c: 108 (char)cl
         *  consonant
         * c: 115 (char)cs
         *  consonant
         * c: 109 (char)cm
         *  consonant
         * c: 119 (char)cw
         *  Sometimes a vowel
         * c: 104 (char)ch
         *  consonant
         * c: 108 (char)cl
         *  consonant
         * c: 103 (char)cg
         *  consonant
         * c: 101 (char)ce
         *  vowel
         * c: 97 (char)ca
         *  vowel
         * c: 104 (char)ch
         *  consonant
         * c: 107 (char)ck
         *  consonant
         * c: 99 (char)cc
         *  consonant
         * c: 120 (char)cx
         *  consonant
         * c: 114 (char)cr
         *  consonant
         * c: 101 (char)ce
         *  vowel
         * c: 113 (char)cq
         *  consonant
         * c: 117 (char)cu
         *  vowel
         * c: 99 (char)cc
         *  consonant
         * c: 98 (char)cb
         *  consonant
         * c: 98 (char)cb
         *  consonant
         * c: 107 (char)ck
         *  consonant
         * c: 105 (char)ci
         *  vowel
         * c: 110 (char)cn
         *  consonant
         * c: 97 (char)ca
         *  vowel
         * c: 109 (char)cm
         *  consonant
         * c: 101 (char)ce
         *  vowel
         * c: 115 (char)cs
         *  consonant
         * c: 98 (char)cb
         *  consonant
         * c: 116 (char)ct
         *  consonant
         * c: 119 (char)cw
         *  Sometimes a vowel
         * c: 104 (char)ch
         *  consonant
         * c: 107 (char)ck
         *  consonant
         * c: 106 (char)cj
         *  consonant
         * c: 117 (char)cu
         *  vowel
         * c: 114 (char)cr
         *  consonant
         * c: 117 (char)cu
         *  vowel
         * c: 107 (char)ck
         *  consonant
         * c: 122 (char)cz
         *  consonant
         * c: 112 (char)cp
         *  consonant
         * c: 103 (char)cg
         *  consonant
         * c: 119 (char)cw
         *  Sometimes a vowel
         * c: 115 (char)cs
         *  consonant
         * c: 113 (char)cq
         *  consonant
         * c: 112 (char)cp
         *  consonant
         * c: 122 (char)cz
         *  consonant
         * c: 100 (char)cd
         *  consonant
         * c: 121 (char)cy
         *  Sometimes a vowel
         * c: 99 (char)cc
         *  consonant
         * c: 121 (char)cy
         *  Sometimes a vowel
         * c: 114 (char)cr
         *  consonant
         * c: 102 (char)cf
         *  consonant
         * c: 106 (char)cj
         *  consonant
         * c: 113 (char)cq
         *  consonant
         * c: 97 (char)ca
         *  vowel
         * c: 104 (char)ch
         *  consonant
         * c: 120 (char)cx
         *  consonant
         * c: 120 (char)cx
         *  consonant
         * c: 104 (char)ch
         *  consonant
         * c: 118 (char)cv
         *  consonant
         *
         * 注意：
         *  不使用break;会执行到default
         */

    }
}
